package java8.lambda.demo01;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

import java.util.List;

import static org.assertj.core.api.AssertionsForClassTypes.assertThat;

/**
 * @author ChangLiang
 * @date 2020/4/22
 */
public class AppTest extends AbstractAppleBeforeTest {

    @Test
    @DisplayName("test ApplePredicate")
    public void test() {
        List<Apple> greenApples = AppleFilter.findApple(list, "green");
        assertThat(greenApples.size()).isEqualTo(2);
    }

    @Test
    @DisplayName("test ApplePredicate")
    public void test2() {
        List<Apple> greenApples = AppleFilter.findApple(list, 150);
        assertThat(greenApples.size()).isEqualTo(1);
    }

    @Test
    @DisplayName("test ApplePredicate")
    public void test3() {
        List<Apple> greenApples = AppleFilter.findApple(list, "green", true);
        assertThat(greenApples.size()).isEqualTo(2);

        List<Apple> greenApples2 = AppleFilter.findApple(list, 150, false);
        assertThat(greenApples2.size()).isEqualTo(1);
    }


}
